package com.datamation.swadeshi.adapter;

import android.app.ActionBar;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.datamation.swadeshi.R;

public class SetTitleAdapter{
	
	// Title name method
	public void createCutomActionBarTitle(String title, Activity activity) {
		// TODO Auto-generated method stub
		activity.getActionBar().setDisplayShowCustomEnabled(true);
		activity.getActionBar().setDisplayShowTitleEnabled(false);
		//activity.getActionBar().setIcon(new ColorDrawable(activity.getResources().getColor(android.R.color.transparent))); 
		LayoutInflater inflator = LayoutInflater.from(activity);
		View v = inflator.inflate(R.layout.custom_action_bar, null);

		
		Typeface tf = Typeface.createFromAsset(activity.getAssets(),
				"fonts/coopbl.ttf");

		TextView tvTitle = (TextView) v.findViewById(R.id.titleFragment1);
		tvTitle.setText(title);
		tvTitle.setTypeface(tf);

		// assign the view to the actionbar
		activity.getActionBar().setCustomView(v);
	}
	
	// Title name method
	public void createCutomActionBarTitleFont2(String title, Activity activity) {
		// TODO Auto-generated method stub
		activity.getActionBar().setDisplayShowCustomEnabled(true);
		activity.getActionBar().setDisplayShowTitleEnabled(false);

		LayoutInflater inflator = LayoutInflater.from(activity);
		View v = inflator.inflate(R.layout.custom_action_bar, null);

		
		Typeface tf = Typeface.createFromAsset(activity.getAssets(),
				"fonts/OpenSans-Regular.ttf");

		TextView tvTitle = (TextView) v.findViewById(R.id.titleFragment1);
		tvTitle.setText(title);
		tvTitle.setGravity(android.view.Gravity.CENTER);
		tvTitle.setTypeface(tf);

		// assign the view to the actionbar
		activity.getActionBar().setCustomView(v);
	}	
	//Title bar color 
	public void  setTitleBarColor(Activity activity){
		ActionBar bar = activity.getActionBar();
		bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4682B4")));
	}
}
